package com.ym.medical.service.impl;

import com.ym.core.utils.tkmybatis.BaseSVImpl;
import com.ym.medical.dao.SysSensitiveWordDao;
import com.ym.medical.domain.entity.SysSensitiveWordEntity;
import com.ym.medical.domain.param.SysSensitiveWordQueryParam;
import com.ym.medical.domain.param.SysSensitiveWordUpdateParam;
import com.ym.medical.domain.vo.SysSensitiveWordListPcVO;
import com.ym.medical.service.ISysSensitiveWordSV;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 敏感词汇配置Service业务层处理
 *
 * @author ym
 * @date 2020-08-18
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SysSensitiveWordSVImpl extends BaseSVImpl<SysSensitiveWordEntity, SysSensitiveWordDao> implements ISysSensitiveWordSV {

	/**
	 * 查询敏感词汇配置列表
	 *
	 * @param queryParam 敏感词汇配置 查询参数
	 * @return 敏感词汇配置
	 */
	@Override
	public List<SysSensitiveWordListPcVO> selectListPC(SysSensitiveWordQueryParam queryParam) {
		List<SysSensitiveWordListPcVO> sysSensitiveWords = mapper.selectListPC(queryParam);
		return sysSensitiveWords;
	}

	/**
	 * 新增敏感词汇配置
	 *
	 * @param updateParam 敏感词汇配置 新增参数
	 * @return 结果
	 */
	@Override
	public Long insertPC(SysSensitiveWordUpdateParam updateParam) {
		SysSensitiveWordEntity entity = updateParam.covert();
		this.insert(entity);
		return entity.getId();
	}

	/**
	 * 修改敏感词汇配置
	 *
	 * @param updateParam 敏感词汇配置 修改参数
	 * @return 结果
	 */
	@Override
	public int updateByIdPC(SysSensitiveWordUpdateParam updateParam) {
		SysSensitiveWordEntity entity = updateParam.covert();
		int result = this.updateById(entity);
		return result;
	}
}
